<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/fmt.tld" prefix="fmt" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>添加催收记录</title>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>
<body class="iframeBody">
<div class="Wrapper">
    <form id="addCltForm">
        <input type="hidden" id="cltAuthId" name="cltAuthId" value="${rskCltAuth.id}"/>
        <%--客户付款账户--%>
        <div class="fieldset1 tabel_col clearFix">
            <div class="fieldBox col_50">
                <div class="label">客户名称</div>
                <div class="field">${rskCltAuth.cstNm}</div>
            </div>
            <div class="fieldBox col_50">
                <div class="label">催收方式</div>
                <div class="field">
                    <input name="collectWayCd" id="collectWayCd" data-value="" placeholder="请选择" ltype="combobox" class="ui-textbox" validate="">
                </div>
            </div>
            <div class="fieldBox col_50">
                <div class="label">委案金额</div>
                <div class="field">
                    <fmt:formatNumber value="${rskCltAuth.authAmt==null?null:rskCltAuth.authAmt/100}" type="currency" pattern="￥#,#00.0#"/>
                </div>
            </div>
            <div class="fieldBox col_50">
                <div class="label">委案日期</div>
                <div class="field">
                    <fmt:formatDate value="${rskCltAuth.startDate}" pattern="yyyy-MM-dd"/>
                </div>
            </div>
            <div class="fieldBox col_50">
                <div class="label"><span class="requiredSymbol">*</span>联系人</div>
                <div class="field">
                    <input type="text" id="lkMan" name="lkMan" class="ui-textbox" value="" validate="{required:true,stringMaxLength:30}"/>
                </div>
            </div>
            <div class="fieldBox col_50">
                <div class="label"><span class="requiredSymbol">*</span>联系电话</div>
                <div class="field">
                    <input type="text" id="lkPhone" name="lkPhone" class="ui-textbox" value="" validate="{required:true,stringMaxLength:30}"/>
                </div>
            </div>
            <div class="fieldBox col_100">
                <div class="label">欠款原因</div>
                <div class="field">
                    <input name="ovdReasonCd" id="ovdReasonCd" data-value="" placeholder="请选择" ltype="combobox" class="ui-textbox" validate="">
                </div>
            </div>
            <div class="fieldBox col_100">
                <div class="label">催收详情</div>
                <div class="field">
                    <textarea name="collectRem" id="collectRem" rows="4" class="" style="width:98%" maxlength="500"></textarea>
                </div>
            </div>
            <div class="fieldBox col_100">
                <div class="label">附件上传</div>
                <div class="field">
                    <jsp:include page="../../system/sysUlFilesRec/sysSysUlFilesRecUpload2.jsp" flush="true">
                        <jsp:param name="filePath" value="cltAuth"/>
                    </jsp:include>
                </div>
            </div>
        </div>
    </form>
</div>


<script type="text/javascript">
    var basePath = '<%=path%>';
    var cltAuthId = $("#cltAuthId").val();
    $(function () {
        // 催收方式
        $("#collectWayCd").ligerComboBox({valueField: 'key', textField: 'value'});
        liger.get("collectWayCd").setData(${cltWayCdList});
        // 欠款原因
        $("#ovdReasonCd").ligerComboBox({valueField: 'key', textField: 'value'});
        liger.get("ovdReasonCd").setData(${debtCauseCdList});


        $("#addCltForm").ligerForm({
            validate: true
        });

        frameElement.dialog.onOk = function () {
            var form = liger.get("addCltForm");
            if (!form.valid()) {
                top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO, SQ_type: "warning"});
                return false;
            }
            $.ligerDialog.confirm("确定添加催收记录吗？", function (flag) {
                if (flag == false) return;
                var fileParams = getUploadResultParams();//获取附件上传的信息
                var formData = form.getData();
                formData.bizNo = cltAuthId;
                formData.fileParams = JSON.stringify(fileParams);

                var wait_dialog;
                $.ajax({
                    type: 'post',
                    dataType: 'json',
                    data: formData,
                    url: basePath + '/clt/auth/record/addCltRcd.do',
                    beforeSend: function () {
                        wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
                    },
                    success: function (msg) {
                        wait_dialog.close();
                        if (msg.success == 1) {
                            $.ligerDialog.SQalert({content: msg.info, SQ_showButtons: true, SQ_type: "success", onClose: function () {
                                    frameElement.dialog.close();
                                }});
                        } else {
                            $.ligerDialog.SQalert({content: msg.info, SQ_showButtons: true, SQ_type: "error"});
                        }
                    }
                });
            });
        }

        // 解决查看图片被遮盖的问题
        $(".upfileBoxs").on("click", "a.fileIcon", function () {
            // 在iframe子页面获取父页面元素
            $("div.zoomImgWrap", parent.document).css('z-index', 9999);
        });
    });

</script>

</body>
</html>

